Add Connect API contract test harness (connect-api-contracts)#3644
Closed
zackverham wants to merge 3 commits intomainfrom
Closed
Add Connect API contract test harness (connect-api-contracts)#3644zackverham wants to merge 3 commits intomainfrom
zackverham wants to merge 3 commits intomainfrom
Conversation
…ehavior Introduces a contract test suite in test/connect-api-contracts/ that validates how the Publisher communicates with Posit Connect's API. Tests cover all 15 APIClient methods (authentication, content CRUD, bundles, tasks, settings, integrations, deployment validation) using a mock Connect server. Includes error response coverage for authentication (401, locked user, unconfirmed user, viewer role), task failures, validation errors, and generic HTTP errors. A response override mechanism enables per-test mock configuration for error scenarios. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7 tasks
Replace the previous approach (routing through Publisher's HTTP API) with a thin Go harness that wraps each APIClient method as its own endpoint. This lets every method be tested independently without needing a standalone Publisher API trigger. - Create harness/main.go with 15 POST endpoints (one per APIClient method) - Rewrite setup.ts to build and spawn the harness instead of the publisher binary - Rewrite go-publisher-client.ts to call harness endpoints - Un-skip all 14 previously skipped test suites (81 tests now pass) - Update authentication tests to match harness response shape - Add clearMockOverrides to all beforeEach hooks to prevent cross-file contamination - Disable vitest file parallelism (shared mock server) - Add build-connect-harness recipe to justfile Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…agement Replace 15 separate handler functions with a single POST /call endpoint that dispatches via a switch on the method name. Move mock request clear/fetch into the harness so the TS client no longer manages mock state directly. - main.go: 468 → 262 lines (single handleCall + dispatch function) - go-publisher-client.ts: 280 → 106 lines (one-liner methods via generic call helper) - get-settings.test.ts: uses capturedRequests from harness response instead of getMockRequests() - client.ts: add optional capturedRequests array to ConnectContractResult Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test/connect-api-contracts/— a contract test suite that validates how Publisher communicates with Posit Connect's APIAPIClientmethods: authentication, content CRUD, bundles, tasks, settings, integrations, and deployment validationjust test-connect-contractsrecipeContext
Split from #3640 into three focused PRs:
test/api-contracts/— Publisher API contract tests (separate PR)test/connect-api-contracts/— Connect API contract teststest/extension-api-contracts/— Extension API contract tests (separate PR)Test plan
just build && just test-connect-contractspasses (12 active tests, rest skipped)🤖 Generated with Claude Code